import {
    createRouter,
    createWebHistory
} from "vue-router";
import Home from "../views/Home.vue";

const routes = [{
        path: '/',
        redirect: '/dashboard'
    },
    {
        path: "/",
        name: "Home",
        component: Home,
        children: [{
                path: "/dashboard",
                name: "dashboard",
                meta: {
                    title: '系统首页'
                },
                component: () => import(
                    /* webpackChunkName: "dashboard" */
                    "../views/Dashboard.vue")
            },
            {
                path: "/cmdb",
                name: "Cmdb",
                meta: {
                    title: "cmdb",
                },
                component: () => import(
                    "../views/devops/cmdb/Cmdb.vue"
                )
            },
            {
                path: "/ansible",
                name: "ansible",
                meta: {
                    title: "ansible",
                },
                component: () => import(
                    "../views/devops/ansible/Ansible.vue"
                )
            },

        ]
    },
    {
        path: "/login",
        name: "Login",
        meta: {
            title: '登录'
        },
        component: () => import(
            /* webpackChunkName: "login" */
            "../views/Login.vue")
    },

    {
        path: "/register",
        name: "Register",
        meta: {
            title: '注册'
        },
        component: () => import(
            "../views/Register.vue")
    },

];

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
});

export default router;